package com.pandora.credit.mongo.entity;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.util.Date;

/**
 * @author developer
 */
@Document(collection = "activities")
public class MongoActivity {

    @Field("_id")
    @JsonProperty("id")
    private Long id;
    private String name;
    @Field("img_url")
    @JsonProperty("img_url")
    private String imgUrl;
    @Field("dest_url")
    @JsonProperty("dest_url")
    private String destUrl;
    private String description;
    @Field("created_time")
    @JsonProperty("created_time")
    private Date createdTime;
    private MongoActivityShare sharing;

    public MongoActivity(){}

    public MongoActivity(Long id, String name, String imgUrl, String destUrl,
                         String description, Date createdTime, MongoActivityShare sharing) {
        this.id = id;
        this.name = name;
        this.imgUrl = imgUrl;
        this.destUrl = destUrl;
        this.description = description;
        this.createdTime = createdTime;
        this.sharing = sharing;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getImgUrl() {
        return imgUrl;
    }

    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }

    public String getDestUrl() {
        return destUrl;
    }

    public void setDestUrl(String destUrl) {
        this.destUrl = destUrl;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }

    public MongoActivityShare getSharing() {
        return sharing;
    }

    public void setSharing(MongoActivityShare sharing) {
        this.sharing = sharing;
    }

    public static class MongoActivityShare {

        @Field("wechat_firends")
        @JsonProperty("wechat_firends")
        private MongoActivityShareSub wechatFirends;
        private MongoActivityShareSub weibo;
        @Field("wechat_timeline")
        @JsonProperty("wechat_timeline")
        private MongoActivityShareSub wechatTimeline;

        public MongoActivityShare(){}

        public MongoActivityShare(MongoActivityShareSub wechatFirends,
                                  MongoActivityShareSub weibo, MongoActivityShareSub wechatTimeline) {
            this.wechatFirends = wechatFirends;
            this.weibo = weibo;
            this.wechatTimeline = wechatTimeline;
        }

        public MongoActivityShareSub getWechatFirends() {
            return wechatFirends;
        }

        public void setWechatFirends(MongoActivityShareSub wechatFirends) {
            this.wechatFirends = wechatFirends;
        }

        public MongoActivityShareSub getWeibo() {
            return weibo;
        }

        public void setWeibo(MongoActivityShareSub weibo) {
            this.weibo = weibo;
        }

        public MongoActivityShareSub getWechatTimeline() {
            return wechatTimeline;
        }

        public void setWechatTimeline(MongoActivityShareSub wechatTimeline) {
            this.wechatTimeline = wechatTimeline;
        }
    }

    public static class MongoActivityShareSub {

        @Field("share_sub_title")
        @JsonProperty("share_sub_title")
        private String shareSubTitle;
        @Field("img_url")
        @JsonProperty("img_url")
        private String imgUrl;
        private String name;
        @Field("dest_url")
        @JsonProperty("dest_url")
        private String destUrl;

        public MongoActivityShareSub(){}

        public MongoActivityShareSub(String shareSubTitle, String imgUrl, String name, String destUrl) {
            this.shareSubTitle = shareSubTitle;
            this.imgUrl = imgUrl;
            this.name = name;
            this.destUrl = destUrl;
        }

        public String getShareSubTitle() {
            return shareSubTitle;
        }

        public void setShareSubTitle(String shareSubTitle) {
            this.shareSubTitle = shareSubTitle;
        }

        public String getImgUrl() {
            return imgUrl;
        }

        public void setImgUrl(String imgUrl) {
            this.imgUrl = imgUrl;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getDestUrl() {
            return destUrl;
        }

        public void setDestUrl(String destUrl) {
            this.destUrl = destUrl;
        }
    }
}
